package com.dkm.biz.gl.domain;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import com.dkm.base.core.helper.SpringHelper;
import com.dkm.biz.domain.AbstractDomain;
import com.dkm.biz.gl.persistence.dao.GlCateQueryDao;
import com.dkm.biz.gl.persistence.dao.GlCateTypeDao;
import com.dkm.biz.gl.persistence.entity.GlCatePo;
import com.dkm.biz.gl.persistence.entity.GlCateTypePo;

/**
 * 对象功能:系统分类类型 领域对象实体
 * 开发人员:winston
 * 创建时间:2014-06-04 15:58:45
 */
@Service
@Scope("prototype")
public class GlCateType extends AbstractDomain<String, GlCateTypePo>{
	 
	 private GlCateTypeDao glCateTypeDao = null;
	
	 
	 private GlCateQueryDao glCateQueryDao=null;

	protected void init(){
		glCateTypeDao = SpringHelper.getBean(GlCateTypeDao.class);
		glCateQueryDao=SpringHelper.getBean(GlCateQueryDao.class);
		setDao(glCateTypeDao);
	}	 
	
	public void save(){
		super.save();
		
		//删除关联的属性
		Map<String,Object> params=new HashMap<String,Object>();
		params.put("typeKey", getData().getKey());
			
		//关联属性
	}
	
	public boolean delete(String id){
		Map<String,Object> params=new HashMap<String,Object>();
		params.put("typeKey", getData().getKey());
		List<GlCatePo> glCatePos=glCateQueryDao.findByTypeKey(getData().getKey());
		if(glCatePos!=null && glCatePos.size()>0){
			return false;
		}
		super.destroy(id);
		return true;
	}
	
	 
}
